<?php

namespace App\Imports;

use App\Services\Designer\Model\Performance;
use Maatwebsite\Excel\Concerns\ToModel;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\ToCollection;
use Illuminate\Support\Facades\Log;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Illuminate\Support\Facades\Auth;


class PerformanceImportCopy implements ToModel,WithHeadingRow{

    private $userId;

    public function __construct($val)
    {
        $this->userId = $val;
        Log::info($this->userId);
    }



    public function model(array $row)
    {
        Log::info($row);
        return new Performance([
            'shop_name' => $row['shop_name'],
            'erp_user_id' => $row['erp_user_id'],
            'order_level' => $row['order_level'],
            'cost_category' => $row['cost_category'],
            'charge_level' => $row['charge_level'],
            'order_square' => $row['order_square'],
            'performance' => $row['performance'],
            'time' => $row['time'],
            'place_order_time' => $row['place_order_time'],
            'place_order_square' => $row['place_order_square'],
            'place_order_performance' => $row['place_order_performance'],
            'c_order_square' => $row['c_order_square'],
            'c_order_money' => $row['c_order_money'],
            'c_order_performance' => $row['c_order_performance'],
            'inside_space' => $row['inside_space'],
            'onum' => $row['onum'],
            'remark' => $row['remark'],
            'user_id' => $this->userId,
        ]);
    }

    public function headingRow(): int
    {
        return 2;
    }
}



